package test4;
//字符串替换
public class TestDemo3 {
    public static void main(String[] args) {
        String str="ababcabcdabcde";
        String ret=str.replace('a','g');
        System.out.println(ret);//gbgbcgbcdgbcde
        System.out.println("====");
        String ret1=str.replace("ab","pp");
        System.out.println(ret1);//ppppcppcdppcde
        System.out.println("========");
        String ret2=str.replaceFirst("ab","pp");
        System.out.println(ret2);//ppabcabcdabcde
    }
}
